package com.wpi.iCoach;

import com.google.android.maps.GeoPoint;

/**
 * This class contains all the information this App needs 
 * to display on the map and list. And all of them have get() 
 * and set() method.
 * @author Kenneth J. Loomis (kjloomis),
 *         Kevin Chen(xchen)
 * @version June 2012
 */
public class CurrentMap {

	//private static CurrentMap selfRef;
	
	/**
	 * @param hereLat   the latitude of current location of user
	 * @param hereLon   the longitude of current location of user
	 * @param thereLat  the latitude of exact location of some services
	 * @param thereLon  the longitude of exact location of some services
	 */
	private double hereLat, hereLon, thereLat, thereLon;
	
	/**
	 * @param here   the GeoPoint of current location of user with given latitude and longitude
	 * @param there  the GeePoint of exact location of some services with given latitude and longitude
	 */
	private GeoPoint here, there;
	
	/**
	 * @param name      the name of some services with exact location 
	 * @param visits    the visit times of some services with exact location 
	 * @param distance  the distance between exact location of some services and current location of user 
	 */
	public String name, visits, distance;
	
	/**
	 * @param rating   the rating of some services with exact location  
	 */
	public float rating;
	
	
	//CurrentMap ( ) { /* Empty constructor  */ }
	

	/**
	 * This method sets the latitude of current location of user.
	 */
	public void setHereLat(double hereLat) {
		this.hereLat = hereLat;
	}

	/**
	 * This method sets the longitude of current location of user.
	 */
	public void setHereLon(double hereLon) {
		this.hereLon = hereLon;
	}

	/**
	 * This method sets the latitude of exact location of some services.
	 */
	public void setThereLat(double thereLat) {
		this.thereLat = thereLat;
	}

	/**
	 * This method sets the longitude of exact location of some services.
	 */
	public void setThereLon(double thereLon) {
		this.thereLon = thereLon;
	}

	/**
	 * This method gets the latitude of current location of user.
	 * @return hereLat
	 */
	public double getHereLat() {
		return hereLat;
	}
	
	/**
	 * This method gets the longitude of current location of user.
	 * @return hereLon
	 */
	public double getHereLon() {
		return hereLon;
	}

	/**
	 * This method gets the latitude of exact location of some services.
	 * @return thereLat
	 */
	public double getThereLat() {
		return thereLat;
	}

	/**
	 * This method gets the longitude of exact location of some services.
	 * @return thereLon
	 */
	public double getThereLon() {
		return thereLon;
	}

	

	/**
	 * This method gets the name of some services with exact location.
	 * @return name
	 */
	public String getName() {
		return name;
	}

	/**
	 * This method gets the visit times of some services with exact location.
	 * @return visits
	 */
	public String getVisits() {
		return visits;
	}

	/**
	 * This method gets the distance between exact location of some services 
	 * and the current location of user.
	 * @return distance
	 */
	public String getDistance() {
		return distance;
	}

	/**
	 * This method gets the ratings of some services with exact location.
	 * @return rating
	 */
	public float getRating() {
		return rating;
	}

	/*
	public static CurrentMap getMap ( )
	{
	    if ( selfRef == null )
	        selfRef = new CurrentMap ( );
	    return selfRef;
	}
	
	*/
	
	/**
	 * This method sets the name, visit times and rating of some services  
	 * with exact location. And it sets the  distance between exact location 
	 * of some services and the current location of user.
	 */
	public void setAll ( String name, String visits, String distance, float rating )
	{
		this.name = name;
     	this.visits = visits;
     	this.distance = distance;
     	this.rating = rating;
	}
	
	/**
	 * This method sets the GeoPoint of current location of user with given 
	 * latitude and longitude.
	 * @param lat
	 * @param lon
	 */
	public void setHere ( double lat, double lon )
	{
		this.hereLat = lat;
		this.hereLon = lon;
		this.here = new GeoPoint ( ( int ) ( this.hereLat * 1E6 ), 
								 		 ( int ) ( this.hereLon * 1E6 ) );
	}
	
	/**
	 * This method sets the GeoPoint of exact location of some services with given 
	 * latitude and longitude.
	 * @param lat
	 * @param lon
	 */
	public void setThere ( double lat, double lon )
	{
		this.thereLat = lat;
		this.thereLon = lon;
		this.there = new GeoPoint ( ( int ) ( this.thereLat * 1E6 ), 
								 		  ( int ) ( this.thereLon * 1E6 ) );
	}
	
	/**
	 * This method gets the GeoPoint of current location of user.
	 * @return here
	 */
	public GeoPoint getGeoPointHere ( ) { return this.here; };
	
	/**
	 * This method gets the GeoPoint of exact location of some services.
	 * @return there
	 */
	public GeoPoint getGeoPointThere ( ) { return this.there; };
	
	
	/**
	 * This method transforms the the latitude and longitude information of 
	 * current location of user to String type information and return it. 
	 * @return the information of current location of user
	 */
	public String GetHereAsString ( ) 
	{
		return ( Double.toString( hereLat ) + "," + Double.toString( hereLon ) );
	}

	/**
	 * This method transforms the the latitude and longitude information of 
	 * exact location of some services to String type information and return it. 
	 * @return the information of exact location of some services
	 */
	public String GetThereAsString ( ) 
	{
		return ( Double.toString( thereLat ) + "," + Double.toString( thereLon ) );
	}
	
}